package md5image

import (
	"crypto/md5"
	"encoding/hex"
	"io"
	"math/rand"
)

func MD5WithFile(file io.Reader) string {
	m := md5.New()
	io.Copy(m, file)
	sum := m.Sum(nil)
	return hex.EncodeToString(sum)
}

var letters = []rune("djseksm3967sn3omr03bfd82mdwn")

func RandStr(n int) string {
	b := make([]rune, n)
	for i := range b {
		b[i] = letters[rand.Intn(len(letters))]
	}
	return string(b)
}
